package com.emperor.user.logic;

import java.util.ArrayList;
import java.util.List;

import com.emperor.core.logic.BizModelBase;
import com.emperor.employee.logic.Employee;
import com.emperor.role.logic.Role;

public class UserModel extends BizModelBase implements User {
	
	private Long id;
	private String username;
	private String password;
	private Employee employee;
	private String status;
	private Role role;
	
	public Long getId() {
		return id;
	}

	public void setId(Object id) {
		if (id != null) {
			if (id instanceof Long) {
				this.id = (Long) id;
			} else {
				try {
					this.id = new Long(id.toString());
				} catch (Exception e) {
				}
			}
		}
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(Object username) {
		if (username != null) {
			if (username instanceof String) {
				this.username = (String) username;
			} else {
				try {
					this.username = username.toString();
				} catch (Exception e) {
				}
			}
		}
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(Object password) {
		if (password != null) {
			if (password instanceof String) {
				this.password = (String) password;
			} else {
				try {
					this.password = password.toString();
				} catch (Exception e) {
				}
			}
		}
	}

	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Object employee) {
		if (employee != null) {
			if (employee instanceof Employee) {
				this.employee = (Employee) employee;
			}
		}
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(Object status) {
		if (status != null) {
			if (status instanceof String) {
				this.status = (String) status;
			} else {
				try {
					this.status = status.toString();
				} catch (Exception e) {
				}
			}
		}
	}

	public List<String> getFieldNames() {
		List<String> fieldNames = new ArrayList<String>();
		
		fieldNames.add(FLD_ID);
		fieldNames.add(FLD_USERNAME);
		fieldNames.add(FLD_PASSWORD);
		fieldNames.add(FLD_EMPLOYEE);
		fieldNames.add(FLD_ROLE);
		
		fieldNames.add(FLD_CRTBY);
		fieldNames.add(FLD_CRTDATE);
		fieldNames.add(FLD_UPDBY);
		fieldNames.add(FLD_UPDDATE);
		
		return fieldNames;
	}

	public Role getRole() {
		return role;
	}

	public void setRole(Object role) {
		if (role != null) {
			if (role instanceof Role) {
				this.role = (Role) role;
			}
		}
	}
}
